import { RouteRecordRaw } from 'vue-router';
export const all_permission = "*:*:*";

export const dynamicRoutes: Array<any> = [
  {
    path: '/',
    name: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    permissions: all_permission,
    meta: {
      title: '首页'
    },
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/home/index.vue'),
        permissions: all_permission,
        meta: {
          title: '首页',
          isHide: false,
          icon: 'iconfont icon-shouye',
        },
      },
      {
        path: '/area',
        name: 'area',
        component: () => import('@/layout/routerView/parent.vue'),
        redirect: '/area/areaManage',
        permissions: ['venue:list', 'venue:order:list', 'venue:data:list'],
        meta: {
          title: '场地管理',
          isKeepAlive: false,
          isHide: false,
          icon: 'iconfont icon-crew_feature',
        },
        children: [
          {
            path: '/area/areaManage',
            name: 'areaManage',
            component: () => import('@/views/area/areaManage/index.vue'),
            permissions: ['venue:list'],
            meta: {
              title: '场地设置',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementOdometer',
            },
          },
          {
            path: '/area/areaOrder',
            name: 'areaOrder',
            component: () => import('@/views/area/areaOrder/index.vue'),
            permissions: ['venue:order:list'],
            meta: {
              title: '场地订单',
              isKeepAlive: false,
              isHide: false,
              icon: 'iconfont icon-ico',
            },
          },
          {
            path: '/area/areaDate',
            name: 'areaDate',
            component: () => import('@/views/area/areaDate/index.vue'),
            permissions: ['venue:data:list'],
            meta: {
              title: '场地数据',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementConnection',
            },
          },
        ],
      },
      {
        path: '/shop',
        name: 'shop',
        component: () => import('@/layout/routerView/parent.vue'),
        redirect: '/shop/product',
        permissions: ['product:specification', 'product:list', 'product:order:list'],
        meta: {
          title: '商城管理',
          isKeepAlive: false,
          isHide: false,
          icon: 'iconfont icon-crew_feature',
        },
        children: [
          {
            path: '/shop/specification',
            name: 'specificationManage',
            component: () => import('@/views/shop/specification/index.vue'),
            permissions: ['product:specification'],
            meta: {
              title: '商品规格',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementOdometer',
            },
          },
          {
            path: '/shop/product',
            name: 'productManage',
            component: () => import('@/views/shop/product/index.vue'),
            permissions: ['product:list'],
            meta: {
              title: '商品列表',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementOdometer',
            },
          },
          {
            path: '/shop/product/add',
            name: 'productAdd',
            component: () => import('@/views/shop/product/add.vue'),
            permissions: ['product:list'],
            meta: {
              title: '添加商品',
              isKeepAlive: false,
              isHide: true,
              icon: 'elementOdometer',
            },
          },
          {
            path: '/shop/order',
            name: 'orderManage',
            component: () => import('@/views/shop/order/index.vue'),
            permissions: ['product:order:list'],
            meta: {
              title: '订单管理',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementOdometer',
            },
          }
        ],
      },
      {
        path: '/competition',
        name: 'competition',
        component: () => import('@/layout/routerView/parent.vue'),
        redirect: '/competition/competitionManage',
        permissions: ['race:list'],
        meta: {
          title: '赛事管理',
          isKeepAlive: false,
          isHide: false,
          icon: 'iconfont icon-quanxian',
        },
        children: [
          {
            path: '/competition/competitionManage',
            name: 'competitionManage',
            component: () => import('@/views/competition/competitionManage/index.vue'),
            permissions: ['race:list'],
            meta: {
              title: '赛事列表',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementOfficeBuilding',
            },
          },
          {
            path: '/competition/competitionSet',
            name: 'competitionSet',
            component: () => import('@/views/competition/competitionSet/index.vue'),
            permissions: ['race:list'],
            meta: {
              title: '赛事设置',
              isKeepAlive: false,
              isHide: true,
              icon: 'elementConnection',
            },
          },
          {
            path: '/competition/competitionOperate',
            name: 'competitionOperate',
            component: () => import('@/views/competition/competitionOperate/index.vue'),
            permissions: ['race:list'],
            meta: {
              title: '赛事创建',
              isKeepAlive: false,
              isHide: true,
              icon: 'elementSetUp',
            },
          },
        ],
      },
      {
        path: '/club',
        name: 'club',
        component: () => import('@/layout/routerView/parent.vue'),
        redirect: '/club/index',
        permissions: ['club:list'],
        meta: {
          title: '俱乐部管理',
          isKeepAlive: false,
          isHide: false,
          icon: 'iconfont icon-crew_feature',
        },
        children: [
          {
            path: '/club/index',
            name: '/club/index',
            component: () => import('@/views/club/index.vue'),
            permissions: ['club:list'],
            meta: {
              title: '俱乐部列表',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementSetUp',
            }
          }
        ]
      },
      {
        path: '/base',
        name: 'base',
        component: () => import('@/layout/routerView/parent.vue'),
        redirect: '/news',
        permissions: ['wx:partner:list', 'wx:article:list', 'wx:user:list', 'wx:user_auth:list', 'wx:user_feedback:list', 'wx:banner:list'],
        meta: {
          title: '微信基础管理',
          isKeepAlive: false,
          isHide: false,
          icon: 'iconfont icon-crew_feature',
        },
        children: [
          {
            path: '/base/group',
            name: 'group',
            component: () => import('@/views/base/group/index.vue'),
            permissions: ['wx:partner:list'],
            meta: {
              title: '搭子管理',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementBell',
            },
          },
          {
            path: '/base/news',
            name: 'news',
            component: () => import('@/views/base/news/index.vue'),
            permissions: ['wx:article:list'],
            meta: {
              title: '新闻资讯',
              isKeepAlive: false,
              isHide: false,
              icon: 'elementBell',
            },
          },
          {
            path: '/base/WeChartUser',
            name: 'WeChartUser',
            component: () => import('@/views/base/WeChartUser/index.vue'),
            permissions: ['wx:user:list'],
            meta: {
              title: '微信用户',
              isKeepAlive: false,
              isHide: false,
              icon: 'iconfont icon-caijian',
            },
          },
          {
            path: '/base/identity',
            name: 'identity',
            component: () => import('@/views/base/identity/index.vue'),
            permissions: ['wx:user_auth:list'],
            meta: {
              title: '角色认证',
              isKeepAlive: false,
              isHide: false,
              icon: 'iconfont icon-icon-',
            },
          },
          {
            path: '/base/feed',
            name: 'feed',
            component: () => import('@/views/base/feed/index.vue'),
            permissions: ['wx:user_feedback:list'],
            meta: {
              title: '反馈意见',
              isKeepAlive: false,
              isHide: false,
              icon: 'iconfont icon--chaifenlie',
            },
          },
          {
            path: '/base/banner',
            name: 'banner',
            component: () => import('@/views/base/banner/index.vue'),
            permissions: ['wx:banner:list'],
            meta: {
              title: '轮播图',
              isKeepAlive: false,
              isHide: false,
              icon: 'iconfont icon-caijian',
            },
          },
        ],
      },
    ]
  }
];

/**
 * 定义静态路由
 * @description 前端控制直接改 staticRoutes 中的路由，后端控制不需要修改
 * @returns 返回路由菜单数据
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: 'message.router.login',
      icon: 'iconfont icon-shouye',
    },
  },
  {
    path: '/:path(.*)*',
    name: 'notFound',
    component: () => import('@/views/error/404.vue'),
    meta: {
      title: 'message.staticRoutes.notFound',
      icon: 'iconfont icon-shouye',
    },
  }
];


